<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>

<!DOCTYPE html>
<html>
<head>
<title></title>

<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- 引入bootstrap -->
<link rel="stylesheet" type="text/css"
	href="${pageContext.request.contextPath}/css/bootstrap.min.css">
<!-- 引入JQuery  bootstrap.js-->
<script src="${pageContext.request.contextPath}/js/jquery-3.2.1.min.js"></script>
<script src="${pageContext.request.contextPath}/js/bootstrap.min.js"></script>
</head>
<body>
	<!-- 顶栏 -->
	<jsp:include page="../admin/top.jsp"></jsp:include>
	<!-- 中间主体 -->
	<div class="container" id="content">
		<div class="row">
			<%@ include file="/WEB-INF/jsp/admin/menu.jsp"%>
			<div class="col-md-10">
				<div class="panel panel-default">
					<div class="panel-heading">
						<div class="row">
							<h1 style="text-align: center;">修改接口信息</h1>
						</div>
					</div>
					<div class="panel-body">
						<form class="form-horizontal" role="form"
							action="${pageContext.request.contextPath}/port/editPort"
							id="editfrom" method="post">
							<input type="hidden" name="id" value="${casePortList.id}">
							
							<div class="form-group">
								<label for="inputPassword3" class="col-sm-2 control-label"
									name="itemId">所属环境：</label>
								<div class="col-sm-10">
									<select class="form-control" name="envId" style="width: 55%">
										<option value="0">请选择</option>
										<c:forEach var="caseEnvList" items="${caseEnvList}">
											 <option value="${caseEnvList.id}" <c:if test="${caseEnvList.name==casePortList.envAddress}">selected</c:if> > ${caseEnvList.name}</option>
										</c:forEach>
									</select>
								</div>
							</div>
							
							
							
							<div class="form-group">
								<td><label for="inputEmail3" class="col-sm-2 control-label">接口名称：</label></td>
								<td><input id="portName" name="portName" type="text"
									value="${casePortList.portName}" style="width: 300px;"
									class="form-control" /></td>
							</div>

							<div class="form-group">
								<td><label for="inputEmail3" class="col-sm-2 control-label">接口url：</label></td>
								<td><input id="porturl" name="porturl" type="text"
									value="${casePortList.porturl}" style="width: 230px;"
									class="form-control" /></td>
							</div>
							
							<div class="form-group">
								<td><label for="inputPassword3"
									class="col-sm-2 control-label">请求方式：</label></td>
								<td><c:choose>
										<c:when test="${'0' eq casePortList.type}">
											<label class="checkbox-inline"> <input type="radio"
												name="type" value="0" checked>GET
											</label>
											<label class="checkbox-inline"> <input type="radio"
												name="type" value="1">POST </label></td> 

								</c:when>
								<c:when test="${'1' eq casePortList.type}">
									<label class="checkbox-inline"> <input type="radio"
										name="type" value="0">GET
									</label>
									<label class="checkbox-inline"> <input type="radio"
										name="type" value="1" checked>POST</label>
										</td>
									
								</c:when>
								</c:choose>
								</td>

							</div>
							<div class="form-group">
								<td><label for="inputPassword3"
									class="col-sm-2 control-label">描述：</label></td>
								<td><textarea rows="3" cols="40" id="remark" name="remark"
										value="${casePortList.remark}">${casePortList.remark}</textarea></td>
							</div>

							<div class="form-group">
								<td><label for="inputPassword3"
									class="col-sm-2 control-label">启用状态：</label></td>

								<td><c:choose>
										<c:when test="${'1' eq casePortList.status}">
											<label class="checkbox-inline"> <input type="radio"
												name="status" value="1" checked>启用
											</label>
											<label class="checkbox-inline"> <input type="radio"
												name="status" value="0">不启用 </td> </label>

								</c:when>
								<c:when test="${'0' eq casePortList.status}">
									<label class="checkbox-inline"> <input type="radio"
										name="status" value="1">启用
									</label>
									<label class="checkbox-inline"> <input type="radio"
										name="status" value="0" checked>不启用
										</td>
									</label>
								</c:when>
								</c:choose>
								</td>

							</div>

							<div class="form-group" style="text-align: center">
								<button class="btn btn-default" type="submit">提交</button>
							</div>
						</form>
					</div>

				</div>

			</div>
		</div>
	</div>
	<div class="container" id="footer">
		<div class="row">
			<div class="col-md-12"></div>
		</div>
	</div>
</body>
<script type="text/javascript">
	$("#nav li:nth-child(3)").addClass("active");

	var collegeSelect = $("#college option");
	for (var i = 0; i < collegeSelect.length; i++) {
		if (collegeSelect[i].value == '${teacher.collegeid}') {
			collegeSelect[i].selected = true;
		}
	}

	var degreeSelect = $("#degree option");
	var titleSelect = $("#title option");

	for (var i = 0; i < degreeSelect.length; i++) {
		if (degreeSelect[i].value == '${teacher.degree}') {
			degreeSelect[i].selected = true;
		}
	}
	for (var i = 0; i < titleSelect.length; i++) {
		if (titleSelect[i].value == '${teacher.title}') {
			titleSelect[i].selected = true;
		}
	}
</script>
</html>